<!DOCTYPE html>
<html lang="<?php echo Configure::read('Config.lang'); ?>">
<head>
<!--home-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<?php echo $this->html->charset('utf-8'); ?>
	
	<title><?php echo $title_for_layout; ?></title>
    <?php if (isset($meta_description)) { ?>
    	<meta name="description" content="<?php echo $meta_description; ?>" />
    <?php } else { ?>
	    <meta name="description" content="" />
    <?php } ?>
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
	<?php
		echo $this->Html->meta('icon');
		
		// CSS
		
		echo $this->Html->css('heroic-features');
		echo $this->Html->css('famfamfam-flags');
		echo $this->Html->css('jquery.dataTables');
		// css della libreria humane.js
        echo $this->Html->css('theme/original');
        echo $this->Html->css('select2');
        echo $this->Html->css('custom');
        echo $this->Html->css('animate.min');
		// bootstrap
        echo $this->Html->css('bootstrap.min');

		// JAVASCRIPT

		// TODO se internet explorer 9 inserisco il seguente script
        echo $this->Html->script('humane.min');
		// jquery
		echo $this->Html->script('jquery-1.10.1');
		// https://github.com/ivaynberg/select2/archive/3.5.1.zip#
        echo $this->Html->script('select2');
		
        echo $this->Html->script('jquery.dataTables.min');
		// per la gestione del timer
        echo $this->Html->script('jquery.timer');
		// script proprietario
        echo $this->Html->script('utility');
		// loader js
        echo $this->Html->script('load');
		// bootstrap
        echo $this->Html->script('bootstrap.min');

        //---------------------------------------------
        
		echo $this->fetch('meta');
		echo $this->fetch('css');
		echo $this->fetch('script');
	?>
	
</head>
<body>
     <?php 
        //metto i banner di sessione in una variabile a cui si accede più facilmente..
         $my_banners=$this->Session->read("banners");
         !empty($my_banners["left"]) && $banner_left = $my_banners["left"][rand(0, count($my_banners["left"])-1)]; 
         !empty($my_banners["right"]) && $banner_right =  $my_banners["right"][rand(0, count($my_banners["right"])-1)]; 
         !empty($my_banners["bottom"]) && $banner_bottom =  $my_banners["bottom"][rand(0, count($my_banners["bottom"])-1)]; 
         !empty($my_banners["top"]) && $banner_top =  $my_banners["top"][rand(0, count($my_banners["top"])-1)]; 
    ?>
    
	<?php echo $this->element('carousel'); ?>		
	<?php echo $this->element('top_menu',array("utente"=>$this->Session->read("Auth.User"))); ?>		
    
	<div id="container" style="" class="animated fadeIn">
		<div id="content" class="container" style="width:  100%;">
			<div class="row">
			    <ul class="breadcrumb">
			        <li>
			          <a href="<?php echo $this->webroot.Configure::read("Config.lang"); ?>">Home</a>
			        </li>
			          <div class="pull-right">
	                    <span class="fa-stack fa-lg">
	                      <i class="fa fa-circle fa-stack-2x"></i>
	                      <i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
	                    </span>
	                    <span class="fa-stack fa-lg">
	                      <i class="fa fa-circle fa-stack-2x"></i>
	                      <i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
	                    </span>
	                    <span class="fa-stack fa-lg">
	                      <i class="fa fa-circle fa-stack-2x"></i>
	                      <i class="fa fa-pinterest fa-stack-1x fa-inverse"></i>
	                    </span>
	                 </div>
			    </ul>
			</div>
            <div id="banner_top" class="row" style="text-align: center;margin-top: 0px;padding-top:0px;padding-bottom:20px;">
            	<?php if (!empty($banner_top) && true) { ?>
	            	<?php if ($banner_top["Banner"]["use"]=="F") { ?>
		                <a target="<?php echo $banner_top["Banner"]["target"]==0?"_self":"_blank" ?>" href="<?php echo $banner_top["Banner"]["link"]?>"><img alt="<?php echo $banner_top["Banner"]["descrizione"];?>" src="<?php echo $this->webroot.$banner_top["Foto"]["webpath"]  ?>"></a> <br>
	                <?php } else { 
				        echo html_entity_decode($banner_top["Banner"]["html"] ,ENT_QUOTES);
	                } ?>
                <?php } ?>
            </div>
		     <div class="row">
    		     <div class="col-md-2" style="padding-right: 15px;padding-left: 20px;">
                    <div class="text-center" id="banner_left" >
		            	<?php if (!empty($banner_left)) { ?>
			            	<?php if ($banner_left["Banner"]["use"]=="F") { ?>
		    		        	<a target="<?php echo $banner_left["Banner"]["target"]==0?"_self":"_blank" ?>" href="<?php echo $banner_left["Banner"]["link"]?>"> <img alt="<?php echo $banner_left["Banner"]["descrizione"];?>" class="img-responsive img-thumbnail" src="<?php echo $this->webroot.$banner_left["Foto"]["webpath"]  ?>" ></a> <br> <br>
			                <?php } else { 
						        echo html_entity_decode($banner_left["Banner"]["html"] ,ENT_QUOTES);
			                } ?>
		                <?php } ?>
	                </div>
                </div>
    		    <div class="col-md-8" style="padding-left: 20px;padding-right: 10px;">
	    			<?php echo $this->fetch('content'); ?>
    	        </div>
    		     <div class="col-md-2" style="padding-right: 10px;padding-left: 10px;">
                    <div id="banner_right" class="text-center">
		            	<?php if (!empty($banner_right)) { ?>
			            	<?php if ($banner_right["Banner"]["use"]=="F") { ?>
		    		        	<a target="<?php echo $banner_right["Banner"]["target"]==0?"_self":"_blank" ?>" href="<?php echo $banner_right["Banner"]["link"]?>"> <img alt="<?php echo $banner_right["Banner"]["descrizione"];?>" class="img-responsive img-thumbnail" src="<?php echo $this->webroot.$banner_right["Foto"]["webpath"]  ?>" ></a> <br> <br>
			                <?php } else { 
						        echo html_entity_decode($banner_right["Banner"]["html"] ,ENT_QUOTES);
			                } ?>
		                <?php } ?>
	                </div>
                </div>
    	     </div>
            <div id="banner_bottom" class="row" style="text-align: center;margin-top: 50px;padding-top:20px;padding-bottom:20px;">
            	<?php if (!empty($banner_bottom)) { ?>
	            	<?php if ($banner_bottom["Banner"]["use"]=="F") { ?>
		                <a target="<?php echo $banner_bottom["Banner"]["target"]==0?"_self":"_blank" ?>" href="<?php echo $banner_bottom["Banner"]["link"]?>"><img alt="<?php echo $banner_bottom["Banner"]["descrizione"];?>" src="<?php echo $this->webroot.$banner_bottom["Foto"]["webpath"]  ?>"></a> <br>
	                <?php } else { 
				        echo html_entity_decode($banner_bottom["Banner"]["html"] ,ENT_QUOTES);
	                } ?>
                <?php } ?>
            </div>
            <div class="row" style="text-align: center;margin-top: 50px;padding-top:20px;padding-bottom:20px;background: #ccc;">
				<?php echo $this->element('footer'); ?>
            </div>
	      </div>
		</div>
		

	<?php echo $this->element('message'); ?>

</body>

	<script>
	  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
	
	  ga('create', 'UA-49093895-1', 'free-sport-betting.com');
	  ga('send', 'pageview');
	
	  $("#banner_top").on("click",function(e){
	  	ga('send','event','banner','click','top');
	  });
	  $("#banner_left").on("click",function(e){
	  	ga('send','event','banner','click','left');
	  });
	  $("#banner_right").on("click",function(e){
	  	ga('send','event','banner','click','right');
	  });
	  $("#banner_bottom").on("click",function(e){
	  	ga('send','event','banner','click','bottom');
	  });
	
	</script>

</html>
